/*
 * revers.cpp
 * Copyright (C) 2016 libo <libo@tencent.com>
 *
 * Distributed under terms of the MIT license.
 */
#include <string.h>
#include <stdio.h>

void reverse(char* str) {
  int len = strlen(str);
  if (len == 0 || len == 1) return;
  char *s = str, *e = str + (len - 1);
  while (e > s) {
    char tmp = *e;
    *e = *s;
    *s = tmp;
    ++s;
    --e;
  }
}

int main() {
  char input[10];
  strcpy(input, "test");
  reverse(input);
  printf("%s", input);
  return 0;
}
